{% extends "admin/edit.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}Fly-admin文章管理{% endblock %}


{% block page_content %}



<h1><strong> {{ current_user.username }},欢迎来到Blog后台 </strong><small>{{ moment(g.current_time).format('LLL') }}</small></h1>

<!--     <p>That was {{ moment(g.current_time).fromNow(refresh=True) }}</p>
<script >
document.write("现在是"+(new Date()).toLocaleDateString() + " " + (new Date()).toLocaleTimeString());     
// 时间
</script>  -->
<div class="btn-group">
<a href="{{ url_for('admin.edit') }}" class="btn btn-default" >后台管理员</a>
<a href="{{ url_for('admin.edituser') }}" class="btn btn-default">所有用户</a>
<a href="{{ url_for('admin.editpost') }}" class="btn btn-info">文章管理</a>
<a href="{{ url_for('admin.editcategory') }}" class="btn btn-default">分类管理</a>
<a href="{{ url_for('admin.editcomment') }}" class="btn btn-default">评论管理</a>
</div>
</br>

<h3><strong>文章列表</strong></h3>

<div class="row">
 <div class="col-xs-12">
    <div class="box-body table-responsive no-padding">
      <table class="table table-hover">
        <tr>
          <th>作者</th>
          <th>标题</th>
          <th>发表时间</th>
          <th>操作</th>
          <th>正文</th>
        </tr>
        {% for post in posts %}
        <tr>
          <td><a href="{{ url_for('main.user', username=post.author.username) }}">{{ post.author.username }}</a></td>
          <td><a href="{{ url_for('main.post', id=post.id) }}">{{ post.head }}</a></td>
          <td>{{ moment(post.timestamp).format('L') }}</td>
          <td><a href="{{ url_for('main.edit', id=post.id) }}" class="label label-primary">
              编辑
              </a>&nbsp;&nbsp;
              <a href="{{ url_for('admin.deletepost', id=post.id) }}" class="label label-danger">
              删除
              </a>
          </td>
          <td>
          <a style="text-decoration:none; color:black" href="{{ url_for('main.post', id=post.id) }}">
            {% if post.body[30] %}
            {{ post.body[0:30] }}....
            {% else %}
            {{ post.body}}
            {% endif %}               
          </a>
          </td>
        </tr>
        {% endfor %}
      </table>
    </div><!-- /.box-body -->
<!--   </div> --><!-- /.box -->
</div>
</div>
{% if pagination %}
<div class="pagination">
    {{ macros.pagination_widget(pagination, '.editpost') }}
</div>
{% endif %}
{% endblock %}